using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Runtime.InteropServices;

namespace Xfinity.Rendering.Sas
{
    [Serializable]
    [AttributeUsage(AttributeTargets.Field)]
    public sealed class SasBindAddressAttribute:Attribute
	{
        #region MemberName
        private string memberName;

        /// <summary>
        /// MemberName.
        /// </summary>
        public string MemberName
        {
            [System.Diagnostics.DebuggerStepThroughAttribute]
            get { return memberName; }
            [System.Diagnostics.DebuggerStepThroughAttribute]
            set { memberName = value; }
        }
        #endregion
        public SasBindAddressAttribute(string memberName)
        {
            this.memberName = memberName;
        }
	}
    [Serializable]
    public struct SasHostParameterValues
    {
        [SasBindAddress("Sas.Time")]
        public SasTime Time;
        [SasBindAddress("Sas.EnvironmentMap")]
        public TextureCube EnvironmentMap;
        [SasBindAddress("Sas.Camera")]
        public SasCamera Camera;
        [SasBindAddress("Sas.AmbientLight[{0}]")]
        public SasAmbientLight[] AmbientLight;
        [SasBindAddress("Sas.DirectionalLight[{0}]")]
        public SasDirectionalLight[] DirectionalLight;
        [SasBindAddress("Sas.NumDirectionalLights")]
        public int NumDirectionalLights;
        [SasBindAddress("Sas.PointLight[{0}]")]
        public SasPointLight[] PointLight;
        [SasBindAddress("Sas.SpotLight[{0}]")]
        public SasSpotLight[] SpotLight;
        [SasBindAddress("Sas.Shadow[{0}]")]
        public SasShadow[] Shadow;
        [SasBindAddress("Sas.NumShadows")]
        public int NumShadows;
        [SasBindAddress("Sas.Skeleton")]
        public SasSkeleton Skeleton;
    }
    [Serializable]
    public struct SasTime
    {
        [SasBindAddress("Sas.Time.Now")]
        public float Now;
        [SasBindAddress("Sas.Time.Last")]
        public float Last;
        [SasBindAddress("Sas.Time.FrameNumber")]
        public int FrameNumber;
    }
    [Serializable]
    public struct SasShadow
    {
        [SasBindAddress("Sas.Shadow[{0}].WorldToShadow")]
        public Matrix WorldToShadow;
        [SasBindAddress("Sas.Shadow[{0}].ShadowMap")]
        public Texture2D ShadowMap;
    }
    [Serializable]
    public struct SasSkeleton
    {
        [SasBindAddress("Sas.Skeleton.MeshToJointToWorld[{0}]")]
        public Matrix[] MeshToJointToWorld;
        [SasBindAddress("Sas.Skeleton.NumJoints")]
        public int NumJoints;
    }
    [Serializable]
    [StructLayout(LayoutKind.Explicit)]
    public struct SasCamera
    {
        [SasBindAddress("Sas.Camera.WorldToView")]
        [FieldOffset(0)]
        public Matrix WorldToView;
        [SasBindAddress("Sas.Camera.Projection")]
        [FieldOffset(64)]
        public Matrix Projection;
        [SasBindAddress("Sas.Camera.NearClipping")]
        [FieldOffset(128)]
        public float NearClipping;
        [SasBindAddress("Sas.Camera.FarClipping")]
        [FieldOffset(132)]
        public float FarClipping;
        [SasBindAddress("Sas.Camera.NearFarClipping")]
        [FieldOffset(128)]
        public Vector2 NearFarClipping;
        [SasBindAddress("Sas.Camera.Position")]
        [FieldOffset(136)]
        public Vector3 Position;
    }
    [Serializable]
    public struct SasAmbientLight
    {
        [SasBindAddress("Sas.AmbientLight.Color")]
        public Vector3 Color;
    }
    [Serializable]
    public struct SasDirectionalLight
    {
        [SasBindAddress("Sas.DirectionalLight[{0}].Color")]
        public Vector3 Color;
        [SasBindAddress("Sas.DirectionalLight[{0}].Direction")]
        public Vector3 Direction;
    }
    [Serializable]
    public struct SasPointLight
    {
        [SasBindAddress("Sas.PointLight[{0}].Color")]
        public Vector3 Color;
        [SasBindAddress("Sas.PointLight[{0}].Position")]
        public Vector3 Position;
        [SasBindAddress("Sas.PointLight[{0}].Range")]
        public float Range;
    }
    [Serializable]
    public struct SasSpotLight
    {
        [SasBindAddress("Sas.SpotLight[{0}].Color")]
        public Vector3 Color;
        [SasBindAddress("Sas.SpotLight[{0}].Position")]
        public Vector3 Position;
        [SasBindAddress("Sas.SpotLight[{0}].Direction")]
        public Vector3 Direction;
        [SasBindAddress("Sas.SpotLight[{0}].Range")]
        public float Range;
        [SasBindAddress("Sas.SpotLight[{0}].Theta")]
        public float Theta;
        [SasBindAddress("Sas.SpotLight[{0}].Phi")]
        public float Phi;
    }
}
